//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.zz.ecommerce.utils;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;

public class ReflectUtil {
    public ReflectUtil() {
    }

    public static Field[] getAllField(Class<?> clazz) {
        ArrayList fieldList = new ArrayList();
        Field[] dFields = clazz.getDeclaredFields();
        if(null != dFields && dFields.length > 0) {
            fieldList.addAll(Arrays.asList(dFields));
        }

        Class superClass = clazz.getSuperclass();
        Field[] result;
        if(superClass != Object.class) {
            result = getAllField(superClass);
            if(null != result && result.length > 0) {
                Field[] arr$ = result;
                int len$ = result.length;

                for(int i$ = 0; i$ < len$; ++i$) {
                    Field field = arr$[i$];
                    if(!isContain(fieldList, field)) {
                        fieldList.add(field);
                    }
                }
            }
        }

        result = new Field[fieldList.size()];
        fieldList.toArray(result);
        return result;
    }

    public static boolean isContain(ArrayList<Field> fieldList, Field field) {
        Iterator i$ = fieldList.iterator();

        Field temp;
        do {
            if(!i$.hasNext()) {
                return false;
            }

            temp = (Field)i$.next();
        } while(!temp.getName().equals(field.getName()));

        return true;
    }
}
